import java.util.Scanner;

public class Work1.7 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入一个正整数: ");
        int number = scanner.nextInt();
        // 计算数字和
        int sum = 0;
        while (number > 0) {
            sum += number % 10;
            number /= 10; 
        }
        // 输出结果
        System.out.println("数字和为: " + sum);
        scanner.close();
    }
}
